home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-10-25 | 2.3 KB | 70 lines | [TEXT/MPS ] |
- {[a-,body+,h-,o=100,r+,rec+,t=4,u+,#+,j=20/57/1$,n-]}
- { MCalc.p }
- { Copyright © 1985 - 1990 by Apple Computer, Inc. All rights reserved. }
-
- PROGRAM SpreadSheet;
-
- {$MC68020-} { The main program must be universal code }
- {$MC68881-}
-
- USES
- { • Required for this unit's interface }
-
- { • MacApp }
- UMacApp,
-
- { • Building Blocks }
- UPrinting, UGridView, UTEView,
-
- { • Implementation use }
- Sane, UCalc, USynchScroller;
-
- CONST
- phSplash = 1001; { Application's splash screen }
-
- VAR
- gCalcApplication: TCalcApplication; { The application object }
-
- PROCEDURE InitWithSplashScreen;
- { 1. To avoid heap fragmentation, we allocate space for the DialogRecord on the stack,
- as a local variable in this procedure, so that the dialog record *won't* be allocated
- as a non-relocatable block at the bottom of the heap.
- 2. If we were to pass NIL to GetNewCenteredDialog for the dStorage, then the call to
- GetNewDialog would allocate the dialog record as a non-relocatable block at the bottom
- of the heap leading to heap fragmentation during InitUMacApp's call to MoreMasters. }
-
- VAR
- theDialogRecord: DialogRecord; { allocated on the stack }
-
- BEGIN
- IF (GetNewCenteredDialog(phSplash, @theDialogRecord, Pointer(-1)) <> NIL) THEN
- DrawDialog(@theDialogRecord); { Show splash screen }
-
- { Continue with remainder of initialization }
- InitUMacApp(25); { Initialize MacApp; call MoreMasters 25
- times }
- InitUTEView; { Initialize TEView unit }
- InitUGridView; { Initialize the GridView unit }
- InitUSynchScroller; { Initialize that unit, too }
- InitUPrinting; { Initialize the Printing unit }
-
- New(gCalcApplication); { Allocate the Application object }
- FailNil(gCalcApplication);
- gCalcApplication.ICalcApplication(kFileType); { Initialize the application }
-
- DisposDialog(@theDialogRecord); { Remember to remove the splash screen }
- END;
-
- BEGIN
- InitToolBox; { Essential toolbox and utilities
- initialization }
- PullApplicationToFront; { Pull app to front under MultiFinder™ }
- IF ValidateConfiguration(gConfiguration) THEN { Make sure we can run }
- BEGIN
- InitWithSplashScreen;
- gCalcApplication.Run; { Run the application }
- END
- ELSE
- StdAlert(phUnsupportedConfiguration);
- END.
-